<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
 * FormativeLab
 *
 * An open source application development framework for PHP 5.1.6 or newer
 *
 * @package		FormativeLab
 * @author		FormativeLab Dev Team
 * @copyright	Copyright (c) 2011 - 2013, FormativeLab, Inc.
 * @license		http://www.formativesoft.com/license/
 * @link		http://www.formativesoft.com/
 * @since		Version 2.0
 * @filesource ./application/controllers/adapter.php
 */

// ------------------------------------------------------------------------

/**
 * FormativeLab Adapter Controller
 *
 * @package		FormativeLab
 * @subpackage	controllers
 * @category	controllers
 * @author		Formative Soft Ltd
 * @link		http://www.formativesoft.com/
 */

// ------------------------------------------------------------------------

class Adapter extends FSL_Controller {

	static $helpers	= array();
	static $models	= array('M01I001001', 'M01I002001', 'M01I003001', 'M01I004001', 'M01I005001', 'M01I006001'
					  , 'M01I007001', 'M01I008001', 'M01I009001', 'M01I010001', 'M01I011001', 'M01I012001');

	/**
	 * __construct() Method is an empty constructor. This method use for initialization of 
	 * the controller. This constructor use to load required helpers, model, libraries.
	 *
	 * @access	public
	 * @return  void 
	 **/
	public function __construct(){
        parent::__construct(Renderer::DEFAULTS);
		$this->load->helper(self::$helpers);
		loadModel(self::$models);
    }
	
	/**
	 * javascript() action use to syncronize Extjs 4.1 data proxy URL, API Route with CodeIgniter
	 * Route. This action dynamically changed according to the CodeIgniter Environment changed. No
	 * need to change any javascript code manually.
	 *
	 * @access	public
	 * @return  void 
	 **/
	public function javascript(){
		$this->render->setLayout(Renderer::JAVASCRIPT);
		$this->render->response();
	}
	
	/**
	 * stylesheet() action use to generate dynamic CSS on demand. This action method helpful when
	 * dynamic CSS required.
	 *
	 * @access	public
	 * @return  void 
	 **/
	public function stylesheet(){
		$this->render->setLayout(Renderer::STYLESHEET);
		$this->render->response();
	}
	
	/**
	 * offlinedb() action use to generate offline DB (like web DB) dynamically. To reduce simultaneous
	 * server request, optimized and maximized peformance of an application.
	 *
	 * @access	public
	 * @return  void 
	 **/
	public function offlinedb(){
		$data	= array(
			'M01I006001' => $this->M01I006001->all(),
			'M01I007001' => $this->M01I007001->all(),
			'M01I008001' => $this->M01I008001->all(),
			'M01I009001' =>  $this->M01I009001->all(),
			'M01I010001' => $this->M01I010001->all(),
			'M01I011001' => $this->M01I011001->all()
		);
		$this->render->setLayout(Renderer::OFFLINEDB);
		$this->render->response($data);
	}
}

/* End of file adapter.php */
/* Location: ./application/controllers/adapter.php */